From: Carlos Garnacho Date: Thu, 13 Dec 2018 19:33:45 +0000 (+0100) Subject: volume: Port to MetaSoundPlayer for emitting sounds X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~897^2~1^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a6002652d0dffd3290807a7989160234c158ab0e;p=gnome-shell.git volume: Port to MetaSoundPlayer for emitting sounds Move away from ShellGlobal API, which is too tightly coupled to libcanberra-gtk. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327 --- diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js index 00af791a6..019030570 100644 --- a/js/ui/status/volume.js +++ b/js/ui/status/volume.js @@ -57,6 +57,7 @@ var StreamSlider = new Lang.Class({ }); this._stream = null; + this._volumeCancellable = null; }, get stream() { @@ -129,11 +130,14 @@ var StreamSlider = new Lang.Class({ }, _notifyVolumeChange() { - global.cancel_theme_sound(VOLUME_NOTIFY_ID); - global.play_theme_sound(VOLUME_NOTIFY_ID, - 'audio-volume-change', - _("Volume changed"), - Clutter.get_current_event ()); + if (this._volumeCancellable) + this._volumeCancellable.cancel(); + + this._volumeCancellable = new Gio.Cancellable(); + let player = global.display.get_sound_player(); + player.play_from_theme('audio-volume-change', + _("Volume changed"), + this._volumeCancellable); }, _updateVolume() {